package ModelLayer;
import java.util.ArrayList;

/**
 * Class for objects of Product - Superclass
 * 
 * @author (AF, RA, KP, RL) 
 * @version (2012.06.05)
 */
public abstract class Product
{
    private String productName;
    private String productDescription;
    private int barcode;
    private double price;
    private double offerPrice;
    private double retailPrice;
    private int quantity;
    private ArrayList<ProductItem> productItems;

    /**
     * Constructor for objects of class Product
     * 
     * @param productName name of Product as String 
     * @param productDescription description of Product as String
     * @param barcode barcode of Product as int
     * @param price price of Product as double
     * @param retailPrice retailPrice of Product as double
     * @param quantity quantity of Product as int
     */
    public Product(String productName, String productDescription, int barcode, double price, 
                   double retailPrice, int quantity)
    {
        this.productName = productName;
        this.productDescription = productDescription;
        this.barcode = barcode;
        this.price = price;
        this.offerPrice = 0.0;
        this.retailPrice = retailPrice;
        this.quantity = quantity;
        productItems = new ArrayList<ProductItem>();
    }

    /**
    abstract void addProduct(Product product);
    abstract ArrayList<Product> getChildren();
    */
    public abstract void addPartlist(Partlist partlist);
    abstract ArrayList<Partlist> getChildren();
    
    /**
     * adds a ProductItem
     * 
     * @param productItem productItem to add to Product as ProductItem
     * 
     * @return none
     */
    public void addProductItem(ProductItem productItem)
    {
        productItems.add(productItem);
    }
   
    /**
     * finds name of product
     * 
     * @param none
     * 
     * @return productName as String
     */
    public String getProductName()
    {
        return productName;
    }
    
    /**
     * sets name of product
     * 
     * @param productName productName of product as String
     * 
     * @return none
     */
    public void setProductName(String productName)
    {
        this.productName = productName;
    }
    
    /**
     * finds description of product
     * 
     * @param none
     * 
     * @return productDescription as String
     */
    public String getProductDescription()
    {
        return productDescription;
    }
    
    /**
     * sets description of product
     * 
     * @param productDescription description of product as String
     * 
     * @return none
     */
    public void setProductDescription(String productDescription)
    {
        this.productDescription = productDescription;
    }
    
    /**
     * finds barcode of product
     * 
     * @param none
     * 
     * @return barcode as int
     */
    public int getBarcode()
    {
        return barcode;
    }
    
    /**
     * sets barcode of product
     * 
     * @param barcode barcode of product as int
     * 
     * @return none
     */
    public void setBarcode(int barcode)
    {
        this.barcode = barcode;
    }
    
    /**
     * finds price of product
     * 
     * @param none
     * 
     * @return price as double
     */
    public double getPrice()
    {
        return price;
    }
    
    /**
     * sets price of product
     * 
     * @param price price of product as double
     * 
     * @return none
     */
    public void setPrice(double price)
    {
        this.price = price;
    }
    
    /**
     * finds offer price of product
     * 
     * @param none
     * 
     * @return offerPrice as double
     */
    public double getOfferPrice()
    {
        return offerPrice;
    }
    
    /**
     * sets offer price of product
     * 
     * @param offerPrice offerPrice price of product as double
     * 
     * @return none
     */
    public void setOfferPrice(double offerPrice)
    {
        this.offerPrice = offerPrice;
    }
    
    /**
     * finds retail price of product
     * 
     * @param none
     * 
     * @return retailPrice as double
     */
    public double getRetailPrice()
    {
        return retailPrice;
    }
    
    /**
     * sets retail price of product
     * 
     * @param retailPrice retailPrice price of product as double
     * 
     * @return none
     */
    public void setRetailPrice(double retailPrice)
    {
        this.retailPrice = retailPrice;
    }
   
    /**
     * finds quantity of product
     * 
     * @param none
     * 
     * @return quantity as int
     */
    public int getQuantity()
    {
        return quantity;
    }
    
    /**
     * sets quantity of product
     * 
     * @param quantity quantity of product as int
     * 
     * @return none
     */
    public void setQuantity(int quantity)
    {
        this.quantity = quantity;
    }
    
    /**
     * adjusts quantity of product. Adds input parameter to existing quantity.
     * 
     * @param addToQuantity addToQuantity to add of product as int
     * 
     * @return none
     */
    public void addToQuantity(int addToQuantity)
    {
        this.quantity = quantity + addToQuantity;
    }
}